]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Move child menus to be a PopupMenu-only thing
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 16 Feb 2013 18:42:17 +0000 (13:42 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 18 Feb 2013 18:31:15 +0000 (13:31 -0500)
It doesn't make sense for combo menus, sections, or submenus
to have child menus.

https://bugzilla.gnome.org/show_bug.cgi?id=693572

js/ui/popupMenu.js

index eb3bd3076fcf5a7d6c0aa6f026b79dcc899b07d5..538d9b6e5b7b389cffa53cac1f2b860c4e6c9b08 100644 (file)
@@ -867,7 +867,6 @@ const PopupMenuBase = new Lang.Class({
         this.blockSourceEvents = false;
 
         this._activeMenuItem = null;
-        this._childMenus = [];
         this._settingsActions = { };
 
         this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
@@ -921,26 +920,8 @@ const PopupMenuBase = new Lang.Class({
         return !hasVisibleChildren;
     },
 
-    isChildMenu: function(menu) {
-        return this._childMenus.indexOf(menu) != -1;
-    },
-
-    addChildMenu: function(menu) {
-        if (this.isChildMenu(menu))
-            return;
-
-        this._childMenus.push(menu);
-        this.emit('child-menu-added', menu);
-    },
-
-    removeChildMenu: function(menu) {
-        let index = this._childMenus.indexOf(menu);
-
-        if (index == -1)
-            return;
-
-        this._childMenus.splice(index, 1);
-        this.emit('child-menu-removed', menu);
+    isChildMenu: function() {
+        return false;
     },
 
     /**
@@ -1215,6 +1196,8 @@ const PopupMenu = new Lang.Class({
 
         global.focus_manager.add_group(this.actor);
         this.actor.reactive = true;
+
+        this._childMenus = [];
     },
 
     _boxGetPreferredWidth: function (actor, forHeight, alloc) {
@@ -1241,6 +1224,28 @@ const PopupMenu = new Lang.Class({
         this._boxPointer.setSourceAlignment(alignment);
     },
 
+    isChildMenu: function(menu) {
+        return this._childMenus.indexOf(menu) != -1;
+    },
+
+    addChildMenu: function(menu) {
+        if (this.isChildMenu(menu))
+            return;
+
+        this._childMenus.push(menu);
+        this.emit('child-menu-added', menu);
+    },
+
+    removeChildMenu: function(menu) {
+        let index = this._childMenus.indexOf(menu);
+
+        if (index == -1)
+            return;
+
+        this._childMenus.splice(index, 1);
+        this.emit('child-menu-removed', menu);
+    },
+
     open: function(animate) {
         if (this.isOpen)
             return;